import time
def read2list(file):
    file = open(file, 'r')
    l = file.readlines()
    return (l)

def b_sort(a):
    for i in range (len(a)-1):  
          for j in range  (len(a)-2,i-1,-1):
              if a[j]>a[j+1]:
                      a[j], a[j+1]=a[j+1], a[j] 
m1=read2list ('m1_sorted.txt')
ts = time.time()
b_sort(m1)
tf =  time.time()
print('m1_sorted.txt', (tf-ts)*1000, 'millisec')
m2=read2list ('m2_reverse.txt')
ts = time.time()
b_sort(m2)
tf =  time.time()
print('m2_reverse.txt', (tf-ts)*1000, 'millisec')
m3=read2list ('m3_shuffle.txt')
ts = time.time()
b_sort(m3)
tf =  time.time()
print('m3_shuffle.txt', (tf-ts)*1000, 'millisec')


